[CK] Use SpaceFillingCurve in ThreadwiseTensorSliceTransfer_v3r1 - #5047
[CK] Use SpaceFillingCurve in ThreadwiseTensorSliceTransfer_v3r1#5047tenpercent wants to merge 7 commits into
Conversation
|
Link #4229 for tracking |
01719db to
5050701
Compare
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
5050701 to
28863cf
Compare
Replace O(N^2) ComputeForwardSweep/ComputeDataIndex/ComputeMoveOnDim calls with O(1) SpaceFillingCurve::GetIndex() lookups in RunRead(), RunWrite(), and TransferDataFromSrcThreadScratchToDstThreadScratch(). This reuses the existing SpaceFillingCurve infrastructure (already used by v6r1, v7r2, etc.) to precompute the serpentine traversal indices at compile time, reducing template instantiation depth significantly. Salvages the approach from PR #5047, rebased onto current develop which has the ThreadwiseTransferHelper refactoring. Generated-by: Claude Code (claude-opus-4-6)
28863cf to
8f82d59
Compare
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
|
This pull request has been automatically closed due to inactivity (30 days with no updates). If you'd like to continue working on this, feel free to reopen the PR or create a new one. |
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
|
This pull request has been automatically closed due to inactivity (30 days with no updates). If you'd like to continue working on this, feel free to reopen the PR or create a new one. |
Summary
Refactors
ThreadwiseTensorSliceTransfer_v3r1to useSpaceFillingCurvefor index computation, replacing O(N^2) nestedComputeForwardSweep/ComputeDataIndex/ComputeMoveOnDimcalls with O(1) precomputed lookup viaSFC::GetIndex().This reuses the existing
SpaceFillingCurveinfrastructure already used by v6r1, v7r2, etc. Changes are confined to a single file.What changed
RunRead(): replacedstatic_fordserpentine loop withstatic_foroverSrcSFC::GetIndex()/GetForwardStep()RunWrite(): same pattern withDstSFCTransferDataFromSrcThreadScratchToDstThreadScratch(): OOB check path usesSrcSFC::GetIndex()ComputeSFCCoordinateResetStepinstead ofComputeCoordinateResetStepResults (
example_grouped_conv_fwd_xdl_fp16, n=10, interleaved,-j1,-ftime-trace)grouped_conv_fwd_xdl_fp16(host)grouped_conv_fwd_xdl_fp16(device)Negative controls (unrelated TUs — no significant change)
device_memory(host)device_memory(device)host_tensor(host)host_tensor(device)Assembly equivalence
GPU assembly compared with
-save-temps=objonexample_grouped_conv_fwd_xdl_fp16(gfx942). Result: 7656 instructions in both builds, identical instruction mix. Only difference is a register allocation swap (v[160:161]<->v[162:163]in twobuffer_load_dwordx2/v_cndmask_b32_e64pairs) — functionally identical, no runtime impact.Methodology
-j1for accurate per-TU timingTest plan
Tracking issue: #4229
Generated-by: Claude Code (claude-opus-4-6)